package com.spj.facory;

import com.spj.dao.People;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

public class PeopleFactoryTwo {
    Properties properties;
    public People getPeople(String race) throws Exception {
        properties=new Properties();
        properties.load(this.getClass().getClassLoader().getResourceAsStream("country.properties"));
        String country=properties.getProperty(race);
        Class peopleClass=Class.forName(country);
        People people=(People) peopleClass.getConstructor().newInstance();
        return people;
    }
}
